import React from "react";

import {
  //   NavLink,
  //   Link,
  //   BrowserRouter,
  HashRouter,
  Route,
  Switch,
  Redirect,
} from "react-router-dom";
import Login from "../pages/Login/Login";
import Admin from "../pages/Admin/Admin";
export default function IndexRouter() {
  return (
    <div>
      <HashRouter>
        <Switch>
          <Route path="/login" component={Login}></Route>
          <Route
            path="/"
            render={() =>
              window.sessionStorage.getItem("token") ? (
                <Admin></Admin>
              ) : (
                <Redirect to="/login"></Redirect>
              )
            }
          />
        </Switch>
      </HashRouter>
    </div>
  );
}
